Let M be a manifold with Grassmann structure, i.e. with an isomorphism of the cotangent bundle T^*M\cong E\otimes H with the tensor product of two vector bundles E and H. We define the notion of a half-flat connection \nabla^W in a vector bundle W\to M as a connection whose curvature F\in S^2E\otimes\wedge^2 H\otimes W \subset\wedge^2 T^*M\otimes W. Under appropriate assumptions, for example, when the Grassmann structure is associated with a quaternionic Kaehler structure on M, half-flatness implies the Yang-Mills equations. Inspired by the harmonic space approach, we develop a local construction of (holomorphic) half-flat connections \nabla^W over a complex manifold with (holomorphic) Grassmann structure equipped with a suitable linear connection. Any such connection \nabla^W can be obtained from a prepotential by solving a system of linear first order ODEs. The construction can be applied, for instance, to the complexification of hyper-Kaehler manifolds or more generally to hyper-Kaehler manifolds with admissible torsion and to their higher-spin analogues. It yields solutions of the Yang-Mills equations.